<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="java.sql.*" %>
<%@ page contentType="text/html; charset=utf-8"%>
<jsp:useBean id="dbbean" class="bean.dbbean"></jsp:useBean>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" contentType="text/html; charset=utf-8">
<title>留言展示</title>
</head>
<body>
<%
        String name=(String)session.getAttribute("username");
		
        if(name==null||name.equals("")){
        response.sendRedirect("login.jsp");
        }
     %> 
<%
	String subject,note;
Connection conn=dbbean.getConn();
	Statement stmt=conn.createStatement();
	String mysql="select * from note";
	ResultSet rs=stmt.executeQuery(mysql);
	 out.print("<center>"); 
     out.print("<table border=1>");
     out.print("<tr>");
     out.print("<td bgcolor=yellow>姓名</td>");
     out.print("<td bgcolor=yellow>主题</td>");
     out.print("<td bgcolor=yellow>内容</td>");
     out.print("<td bgcolor=yellow>回复</td>");
     out.print("<td bgcolor=yellow>查看所有回复</td>");
     
  
     while(rs.next()) 
		{ 
			name=rs.getString(1); 
			subject=rs.getString(2);  
			note=rs.getString(3); 
			out.print("<tr>");
			out.print("<td>"+name+"</td>"); 
			out.print("<td>"+subject+"</td>"); 
			out.print("<td>"+note+"</td>");
			out.print("<td><a href='reply.jsp?subject="+subject+"'>回复</a></td>");
			out.print("<td><a href='showreply.jsp?subject="+subject+"'>查看回复</a></td>"); 
			out.print("</tr>");
		} 
		out.print("</table><p>"); 
		out.print("<a href='note.jsp'>返回留言页面</a>");
%>

</body>
</html>